package com.firemoss.ui.blanket.components
{
	import com.firemoss.ui.blanket.loadingSpinnerClasses.LoadingSpinnerDisplay;
	
	public class LoadingSpinner extends AbstractOverlayComponent
	{

		public function set color( value : uint ) : void
		{
			LoadingSpinnerDisplay( view ).spinnerColor = value
		}
		public function get color() : uint
		{
			return LoadingSpinnerDisplay( view ).spinnerColor
		}
		
		public function get disableTargetWhenVisible() : Boolean
		{
			return LoadingSpinnerDisplay(view).disableTargetWhenVisible ? LoadingSpinnerDisplay(view).disableTargetWhenVisible : false
		}
		
		public function set disableTargetWhenVisible( value : Boolean ) : void
		{
			if (LoadingSpinnerDisplay(view))
			{
				LoadingSpinnerDisplay(view).disableTargetWhenVisible = value
			}
		}

		override public function set visible(value:Boolean):void
		{
			super.visible = value
			
			if ( disableTargetWhenVisible && target )
			{
				target.enabled = !value
			}
		}
		
		public function LoadingSpinner() 
		{
			super()
			
			view = new LoadingSpinnerDisplay()
			
			LoadingSpinnerDisplay( view ).spinnerColor = color
		}

	}
}